<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>猴子选大王</title>
    <style>
            a:link,a:visited{
                color: #222;text-decoration: none;}
           a:hover{color: #fd4913;}
       </style>
</head>
<body>
    <h2>猴子选大王</h2>
    <script>
        var total=prompt('请输入猴子的总数：');
        var kick=prompt('踢出第几只猴子：');
        var monkey=[];
        for(var i=1;i<=total;i++){
            monkey.push(i);
        }
        i=0;
        while(monkey.length>1){
            ++i;
            head=monkey.shift();
            if(i%kick!=0){
                monkey.push(head);
            }
        }
        console.log('猴王编号:'+monkey[0]);
    </script>
    <p><a href="default.html">返回目录</a></p>
    <p><a href="第三章.html">返回第三章</a></p>
    <p><a href="省级城市的三级联动.html">下一题</a></p>
    <p><a href="第四章.html">下一章</a></p>
</body>
</html>